//
//  MYGAcademicDetailHeaderTitleView.swift
//  MYDoctor
//
//  Created by Denny on 2024/5/27.
//

import UIKit

class MYGAcademicDetailHeaderTitleView: UITableViewHeaderFooterView {
    @IBOutlet weak var timeLB: UILabel!
    
    @IBOutlet weak var contentlB: UILabel!

    @IBOutlet weak var actionLB: UILabel!
    var tapExtensionCompletion:(()->Void)?
    @IBOutlet weak var bView: UIView!
    
    var isExtend: Bool = false  {
        didSet {
            let titleString = isExtend ? "展开": "收起"
            actionLB.text = titleString
            if isExtend {
                self.bView.addBordorLine(top: true, right: true, bottom: true, left: true, color: UIColor.init(hexString: "f6f6f6"), width: 2)
                self.bView.addCorner(radius: 5)

            }else {
                self.bView.addBordorLine(top: true, right: true, bottom: false, left: true, color: UIColor.init(hexString: "f6f6f6"), width: 2)
                DispatchQueue.main.asyncAfter(deadline:.now() + 0.3 , execute: {
                    self.bView.layer.maskedCorners = [.layerMinXMinYCorner,.layerMaxXMinYCorner]
                    self.bView.layer.cornerRadius = 5
                    self.bView.layer.masksToBounds = true
                })
              
            }
        }
    }
    
   
    override func awakeFromNib() {
        super.awakeFromNib()
        self.contentView.backgroundColor = .white
    }
}
